<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
        <ui:composition template="./../../Template/generalTemplate.xhtml">

            <ui:define name="content">
                <f:view beforePhase="#{confirmSalesOrderManagedBean.initView}">

                    <h:form>
                        <p:panel header ="Sales Order Pending for Final Confirmation" style="height:495px;">
                        <div style="margin-top:20px;margin-left:50px;margin-right: 50px;">
                                 <h:panelGrid columns="2" cellpadding="2">
                                    <h:outputText value="Company Name:" /> 
                                    <h:outputText value="#{confirmSalesOrderManagedBean.customer.name}" />
                                    <h:outputText value="Processed by (SalesMan)"/>
                                    <h:outputText value ="#{confirmSalesOrderManagedBean.salesOrder.processedBy.name}"/>
                                    <h:outputText value= "Date Created"/>
                                    <h:outputText value= "#{confirmSalesOrderManagedBean.salesOrder.dateCreated}"><f:convertDateTime pattern ="dd/MM/yyyy"/></h:outputText>
                                    <h:outputText value= "Total Amount"/>
                                    <h:outputText value= "#{confirmSalesOrderManagedBean.salesOrder.totalAmount}"/>

                                </h:panelGrid> 
                                <br />
                            
                            <p:dataTable dynamic="true" emptyMessage="No product selected" value="#{confirmSalesOrderManagedBean.lineItemList}" var="t">

                                <p:column>
                                    <f:facet name="header">Product Name</f:facet>
                                    #{t.product.productName}
                                </p:column>   

                                <p:column>
                                    <f:facet name="header">Quantity</f:facet>
                                    #{t.quantity}
                                </p:column>

                                <p:column>
                                    <f:facet name="header">Delivery Date</f:facet>
                                    #{t.deliveryDate}
                                </p:column>

                                <p:column>
                                    <f:facet name="header">Delivery Location</f:facet>
                                    #{t.deliveryLocation}
                                </p:column> 

                                <p:column>
                                    <f:facet name="header">Total Price</f:facet>
                                    #{t.price}
                                </p:column> 
                            </p:dataTable>
                            <br />
                            <p:commandButton update="bottomPanel" oncomplete="bottomBar.show();" value ="Confirm" actionListener ="#{confirmSalesOrderManagedBean.confirmSalesOrder}"/>
                        </div>

                        </p:panel>

                        
                        
                        <p:notificationBar position="bottom" effect="slide" widgetVar="bottomBar" styleClass="bottom" >  
                            <f:facet name="close">  
                                <p:graphicImage value="/images/closebar.png" />  
                            </f:facet>  
                            <h:panelGroup id="bottomPanel" style="margin-right:200px;">  
                                <!--<p:messages />-->  
                                <h:outputText value="ERROR: #{confirmSalesOrderManagedBean.errorMessage}"  />  
                            </h:panelGroup>  
                        </p:notificationBar>
                    </h:form>       
                </f:view>

            </ui:define>
        </ui:composition>       
    </body>
</html>
